﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using LGE;

namespace YouOnlyGetOne
{
    public class Door : GameObject
    {
        public static List<Texture2D> Textures = new List<Texture2D>();

        public Door(PlayScreen ps, Vector2 pos, bool isVertical)
            : base(ps, Textures[isVertical ? 0 : 1])
        {
            this.position = pos;
        }

        public override void Update(GameTime gameTime)
        {
            if (Collision(ps.player))
                if (ps.player.keys > 0)
                {
                    ps.player.keys--;
                    alive = false;
                    Audio.PlayCue("door_unlock");
                }
                else
                    ps.player.FixPositionByCollisionWith(this);
        }
    }
}